//
//  MGItem.h
//  Express
//
//  Created by lhongl on 2025/9/25.
//  Copyright © 2025 QM. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@class MGTableViewManage,MGSection,MGItem;

NS_ASSUME_NONNULL_BEGIN

/// cell
typedef void (^ItemCellConfiguration)(__kindof MGTableViewManage *tableVieManager,NSIndexPath *indexPath,__kindof UITableViewCell *cell,__kindof MGItem *item);

/// ItemwillDisplayCell
typedef void (^ItemwillDisplayCell)(__kindof MGTableViewManage *tableVieManager,NSIndexPath *indexPath,__kindof UITableViewCell *cell,__kindof MGItem *item);

/// 选中
typedef void (^ItemDidSelectRow)(__kindof MGTableViewManage *tableVieManager,NSIndexPath *indexPath,__kindof MGItem *item);

/// 上次选中
typedef void (^ItemDidDeselectRow)(__kindof MGTableViewManage *tableVieManager, NSIndexPath *indexPath,__kindof MGItem *item);

/// 滑动
typedef NSArray <UITableViewRowAction *> *_Nullable(^ItemEditActions)(__kindof MGTableViewManage *tableVieManager, NSIndexPath *indexPath,__kindof MGItem *item);

@interface MGItem : NSObject

@property (nonatomic, weak) MGSection *section;

/// 标识符
@property (nonatomic, copy, readonly) NSString *identifier;

/// 高
@property (nonatomic, assign) CGFloat rowHeight;

/// 配置
@property (nonatomic, copy) ItemCellConfiguration cellConfiguration;

/// disolaycell
@property (nonatomic, copy) ItemwillDisplayCell  willDisplayCell;

/// 选择
@property (nonatomic, copy) ItemDidSelectRow didSelectRow;

/// 已选择
@property (nonatomic, copy) ItemDidDeselectRow didDeselectRow;

/// 编辑
@property (nonatomic, copy) ItemEditActions editActions;

- (instancetype)init UNAVAILABLE_ATTRIBUTE;
+ (instancetype)new UNAVAILABLE_ATTRIBUTE;

/// 初始化
- (instancetype)initWithData:(nullable id)data cellClass:(Class)cellClass;

/// 数据
- (id)data;

/// 下标
- (NSIndexPath *)indexPath;

/// 管理
- (void)tableViewManage:(MGTableViewManage *)tableViewManage cell:(__kindof UITableViewCell *)cell;

@end

NS_ASSUME_NONNULL_END
